Auto Deployment of application over tomcat using jenkins
copy war file and tomcat .tar file to home/ubuntu
using winscp application
sudo su -
cd /opt/
ls -lrt
mv /home/ubuntu/apache .
ls -lrt
tar -xvzf apache
ls -lrt
cd apache/
ls -lrt
cd conf/ -> port number check
going to change - port number 9090
ls
vi server.xml -> change port 9090
cd ..
cd bin/
ls
./shutdown.sh
./startup.sh
tomcat hit ip:9090 -> tomcat installed
==========
go to console of jenkins
new job -> autodeployment_tomcat -> freestyle-> ok
build -> pwd-> save
cd /var/lib/jenkins/workspace/autodeployment_tomcat
mv /home/ubuntu/sample.war .
moved jar file to a job
go to jenkins console -> select job -> configure -> post build action -> deploy to container
manage plugin -> DTC plugin
now check the post build configuration -> deploy war/ear to container
**/*.war
context path -> sample
containers -> tomcat 9 -> add -> jenkins
username - > deployer ->pwd:deployer
tomcat url : put url of tomcat with ip
credentials done in jenkins
in machine
switch root
cd /opt/apache/conf
ls
vi tomcat-users.xml
copy code in local file
paste after tomcat users
cd ../webapps/manager/META-INF/
ls
vi context.xml - removing the timer
before value add
cd ..
cd bin/
shutdown
startup
to see the output
run the job once
hit url of tomcat:9090/sample in browser
go to console set cron tab with *****
refresh the tomcat code
=============================
================================================
CICD Pipeline ( Plug in & Groovy script)
PLugins pipline
Delivery pipeline -> manager view
Build Pipeline - > employees view
Build monitor view -> Particular Job Monitor
Parameterized job -> input parameter tracking purpose
go to manage jenkins ->
install plugins
1. delivery pipeline -> give name -> components(initial job) -> apply and ok
2. build pipeline
3. build monitor view
Para-job
build
echo "This is done by $Name"
general -> this job is para-> Name -> sava and apply.
====================
Scripted pipeline
create new job -> give name -> pipeline project -> save
pipeline -> pipeline script ( cpy script in word )-> save
node
{
stage('Commit')
{
echo "This is Code Download from GIT Project Repository.................."
}
stage('Build')
{
echo "This is Build project using maven.................."
}
stage('Manual Test')
{
echo "This is Test project Implementation using Manual Testing................."
}
stage('Test')
{
echo "This is Test project Implementation using Selenium................."
}
stage('Release')
{
echo "This is Delivery using Docker......................................"
}
stage('Monitor')
{
echo "This is Application Logs Monitorinig using tool Splunk............."
}
}
=====
Declarative pipeline
Keep jenkins file in github and copy the url
create new job -> pipeline -> pipline script of scn->
scm=git -> git url -> scriptpath -> jenkinsfile.txt
the file will fail
because we will not conneect git thats why
=======================
Email Notification ( for unstable build )
get into a job -> manage jenkins -> configure system -> email notification -> smtp.gmail.com ->@gmail.com -> use smtp auth->user name -> ur mailid -> pwd -
2 step verification compulsary
go to mail -> security -> app password -> mail -> windows computer -> generate -> 16 digit pwd
use ssl click -> 465
test configuration -> mail id -> test .-> apply and save
create job -> build -> ec= bvjsgfsmhdf->apply save
post build action -> email -> mailid -> send e mail unstable -> save and apply